#!/usr/bin/env python
try:
    import json
except:
    from helper import HelpJson as json
import sys
import class_set
import time
import helper

class CommonMapper(helper.MapperHelper):
    def mapper(self):
        for line in sys.stdin:
            self.loader(line)

    def loader(self, line):
        line = line.strip()
        try:
            node_operator = json.loads(line)
            contentid = node_operator["contentid"]
            uid = node_operator["uid"]
            tm = node_operator["addtime"]
            if time.time() - tm <= 20*24*60*60:
                self.allocator(contentid, uid)
            else:
                pass
        except:
            pass

def main():
    cm = CommonMapper()
    cm.mapper()

if __name__ == '__main__':
    main()
